<template>
	<view>
		<view id="web-info" style="width: 100%;height: 100%;">
			<web-view v-if="!isShow" :src="pdfUrl"></web-view>
			<view class="" style="margin-top: 200rpx;font-size: 40rpx;" v-show="isShow">
				暂无
			</view>
		</view>
	</view>
</template>

<script>
	import {
		customDetail,
		electricity
	} from "@/request/homeApi.js";
	import brl from "@/request/baseUrl.js"
	export default {
		name: 'viewPdf',
		data() {
			return {
				isShow: false,
				pdfUrl: '',
				env: '',
				versionId: '',
				type: ''
			}
		},
		onLoad(params) {

			// this.versionId = params.id
			// this.type = params.type
			// this.pdfUrl = params.pdf
			// console.log(this.type,'this.type',this.pdfUrl)
			this.pdfUrl = 'https://ylk.westts.cn/uploads/20231012/cd9596106fda51d8113e99d847d344ee.pdf'
			// if (this.type == 1) {
			// 	this.pdfUrl = params.pdfUrl
			// } else {
			// 	this.getVersionId(params.id)
			// }

		},


		mounted() {

		},
		methods: {
			// changePdf() {
			// 	electricity().then(res => {
			// 		if (res.code == 200) {
			// 			if (res.data[0].value == null) this.isShow = true
			// 			this.pdfUrl = brl.baseUrl + res.data[0].value
			// 			console.log(this.pdfUrl, 'this.pdfUrl')
			// 			wx.setNavigationBarTitle({
			// 				title: res.data[0].title
			// 			})
			// 		} else {
			// 			uni.showToast({
			// 				title: res.msg,
			// 				duration: 1500,
			// 				icon: 'none',
			// 			})
			// 		}
			// 	})
			// },
			getVersionId(id) {
				customDetail({
					id
				}).then(res => {
					if (res.code == 200) {
						if (res.data.files == null) this.isShow = true
						this.pdfUrl = brl.baseUrl + res.data.files
						console.log(this.pdfUrl, 'res');
					} else {
						uni.showToast({
							title: res.msg,
							duration: 1500,
							icon: 'none',
						})
					}
				})
			},
		}
	}
</script>
<style lang="scss" scoped>
	#web-info {
		width: 100%;
		height: 100%;
		display: flex;
		justify-content: center;
		align-items: center;
	}
</style>